package com.seadragon.app.ksr.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.annotations.Type;
import org.joda.time.LocalDate;
import org.joda.time.LocalTime;

@Entity
@Table(name = "CUSTOMER_EVENT_SUBSCRIPTION", schema = "STAGING")
public class CustomerEventSubscription {
	@Id
	@Column(name = "ID")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "CUSTOMEREVENTSUBSCRIPTIONIDSEQ")
	@SequenceGenerator(name = "CUSTOMEREVENTSUBSCRIPTIONIDSEQ", sequenceName = "STAGING.CUSTOMER_EVENT_SUBSCRIPTION_ID_SEQ", schema = "STAGING")
	private long id;

	@ManyToOne
	@JoinColumn(name="EVENT_SCHEDULE_ID")
	private EventSchedule eventSchedule;
	
	@Column(name="START_TIME", nullable = true)
	@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalTime")
	private LocalTime openingTime;

	@Column(name="END_TIME", nullable = true)
	@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalTime")
	private LocalTime closingTime;

	@Column(name="START_DATE", nullable = true)
	@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDate")
	private LocalDate startDate;

	@Column(name="END_DATE", nullable = true)
	@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDate")
	private LocalDate endDate;

	@Column(name="EVENT_SUBSCRIPTION_TYPE")
	private String subscriptionType;

	@OneToOne(cascade={CascadeType.MERGE})
	@JoinColumn(name="ADDRESS_ID")
	private Address address;
	
	@ManyToOne
	@JoinColumn(name="CUSTOMER_ID")
	private Customer customer;

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public LocalTime getOpeningTime() {
		return openingTime;
	}

	public void setOpeningTime(LocalTime openingTime) {
		this.openingTime = openingTime;
	}

	public LocalTime getClosingTime() {
		return closingTime;
	}

	public void setClosingTime(LocalTime closingTime) {
		this.closingTime = closingTime;
	}

	public LocalDate getStartDate() {
		return startDate;
	}

	public void setStartDate(LocalDate startDate) {
		this.startDate = startDate;
	}

	public LocalDate getEndDate() {
		return endDate;
	}

	public void setEndDate(LocalDate endDate) {
		this.endDate = endDate;
	}

	public String getSubscriptionType() {
		return subscriptionType;
	}

	public void setSubscriptionType(String subscriptionType) {
		this.subscriptionType = subscriptionType;
	}

	public Address getAddress() {
		return address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public EventSchedule getEventSchedule() {
		return eventSchedule;
	}

	public void setEventSchedule(EventSchedule eventSchedule) {
		this.eventSchedule = eventSchedule;
	}
}
